package cn.dnui_wwt524.dnuifood_16110100524.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class RecordSQLiteOpenHelper extends SQLiteOpenHelper {
    private static String DB_NAME = "temp.db";
    private static String TABLE_NAME = "records";
    private static Integer VERSION = 1;
    private static String ID = "id";
    private static String NAME="name";

    public RecordSQLiteOpenHelper(Context context){
        super(context,DB_NAME,null,VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("create table " + TABLE_NAME + "(" +ID+ " integer primary key autoincrement," + NAME + " varchar(100))");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL(" DROP TABLE IF EXISTS "+TABLE_NAME);
        onCreate(db);
    }

}